home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / f90 / omp_lock.z / omp_lock
Encoding:
Text File  |  1998-10-30  |  5.1 KB  |  115 lines

  1. OMP_LOCK(3)                                           Last changed: 2-24-98
  2.  
  3.  
  4. NNAAMMEE
  5.      oommpp__iinniitt__lloocckk, oommpp__ddeessttrrooyy__lloocckk, oommpp__sseett__lloocckk, oommpp__uunnsseett__lloocckk,
  6.      oommpp__tteesstt__lloocckk, OOMMPP__IINNIITT__LLOOCCKK, OOMMPP__DDEESSTTRROOYY__LLOOCCKK, OOMMPP__SSEETT__LLOOCCKK,
  7.      OOMMPP__UUNNSSEETT__LLOOCCKK, OOMMPP__TTEESSTT__LLOOCCKK,  - Set of procedures to manipulate
  8.      locks
  9.  
  10. SSYYNNOOPPSSIISS
  11.      C/C++: (Deferred implementation)
  12.           ##iinntteeggeerr <<oommpp__iinniitt__lloocckk>>
  13.           vvooiidd oommpp__iinniitt__lloocckk((_v_a_r))
  14.  
  15.           ##iinntteeggeerr <<oommpp__ddeessttrrooyy__lloocckk>>
  16.           vvooiidd oommpp__ddeessttoorryy__lloocckk((_v_a_r))
  17.  
  18.           ##iinntteeggeerr <<oommpp__sseett__lloocckk>>
  19.           vvooiidd oommpp__sseett__lloocckk((_v_a_r))
  20.  
  21.           ##iinntteeggeerr <<oommpp__uunnsseett__lloocckk>>
  22.           vvooiidd oommpp__uunnsseett__lloocckk((_v_a_r))
  23.  
  24.           ##iinntteeggeerr <<oommpp__tteesstt__lloocckk>>
  25.           iinntt oommpp__tteesstt__lloocckk((_v_a_r))
  26.  
  27.      Fortran:
  28.           CCAALLLL OOMMPP__IINNIITT__LLOOCCKK((_v_a_r))
  29.  
  30.           CCAALLLL OOMMPP__DDEESSTTRROOYY__LLOOCCKK((_v_a_r))
  31.  
  32.           CCAALLLL OOMMPP__SSEETT__LLOOCCKK((_v_a_r))
  33.  
  34.           CCAALLLL OOMMPP__UUNNSSEETT__LLOOCCKK((_v_a_r))
  35.  
  36.           LLOOGGIICCAALL OOMMPP__TTEESSTT__LLOOCCKK((_v_a_r))
  37.  
  38. IIMMPPLLEEMMEENNTTAATTIIOONN
  39.      IRIX systems
  40.  
  41. SSTTAANNDDAARRDDSS
  42.      OpenMP Fortran API
  43.  
  44. DDEESSCCRRIIPPTTIIOONN
  45.      The following descriptions contain information for Fortran and C/C++.
  46.  
  47.      oommpp__iinniitt__lloocckk, OOMMPP__IINNIITT__LLOOCCKK
  48.           This subroutine initializes a lock associated with the lock
  49.           variable _v_a_r for use in subsequent calls.
  50.  
  51.           The initial state is unlocked.  The lock variable must only be
  52.           accessed through these routines.  In this and the following lock
  53.           routines, _v_a_r should be a scalar integer variable in C and of
  54.           type integer in Fortran and must have a size large enough to hold
  55.           an address.  For example, for 64-bit addressable systems, the
  56.           variable must at least by declared as IINNTTEEGGEERR**88.
  57.  
  58.      oommpp__ddeessttoorryy__lloocckk, OOMMPP__DDEESSTTRROOYY__LLOOCCKK
  59.           This procedure disassociates the given lock variable _v_a_r from any
  60.           locks.
  61.  
  62.      oommpp__sseett__lloocckk, OOMMPP__SSEETT__LLOOCCKK
  63.           This procedure constrins the executing thread to wait until the
  64.           specified lock is available.  The thread is granted ownership of
  65.           the lock when it is available.
  66.  
  67.      oommpp__uunnsseett__lloocckk, OOMMPP__UUNNSSEETT__LLOOCCKK
  68.           This procedure releases the executing thread from ownership of
  69.           the lock.  The behavior is undefined if the thread does not own
  70.           that lock.
  71.  
  72.      oommpp__tteesstt__lloocckk, OOMMPP__TTEESSTT__LLOOCCKK
  73.           This function tries to set the lock associated with the lock
  74.           variable _v_a_r.  It returns nnoonn--zzeerroo (TTRRUUEE) if the lock is
  75.           successfully set; otherwise, it returns zzeerroo (FFAALLSSEE).
  76.  
  77. EEXXAAMMPPLLEESS
  78.      In the following Fortran 90 example, the argument to the lock routines
  79.      should be of size PPOOIINNTTEERR:
  80.  
  81.                 PROGRAM LOCK_USAGE
  82.                 EXTERNAL OMP_TEST_LOCK
  83.                 LOGICAL OMP_TEST_LOCK
  84.  
  85.                 INTEGER LCK         ! THIS VARIABLE SHOULD BE POINTER SIZED
  86.  
  87.                 CALL OMP_INIT_LOCK(LCK)
  88.           !$OMP PARALLEL SHARED(LCK) PRIVATE(ID)
  89.                 ID = OMP_GET_THREAD_NUM()
  90.                 CALL OMP_SET_LOCK(LCK)
  91.                 PRINT *, 'MY THREAD ID IS ', ID
  92.                 CALL OMP_UNSET_LOCK(LCK)
  93.  
  94.                 DO WHILE (.NOT. OMP_TEST_LOCK(LCK))
  95.                   CALL SKIP(ID)     ! WE DO NOT YET HAVE THE LOCK
  96.                                     ! SO WE MUST DO SOMETHING ELSE
  97.                 END DO
  98.  
  99.                 CALL WORK(ID)       ! WE NOW HAVE THE LOCK
  100.                                     ! AND CAN DO THE WORK
  101.                 CALL OMP_UNSET_LOCK( LCK )
  102.           !$OMP END PARALLEL
  103.  
  104.                 CALL OMP_DESTROY_LOCK( LCK )
  105.  
  106.                 END
  107.  
  108. SSEEEE AALLSSOO
  109.      oommpp__nneesstteedd(3) to manipulate or report status of nested parallelism,
  110.  
  111.      oommpp__tthhrreeaaddss(3) for runtime library procedures used to set, call or
  112.      return numbers of threads
  113.  
  114.      This man page is available only online.
  115.